<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box{
            width: 100px;
            height: 100px;
            border:10px solid  red;
        }
        .black{
            background: black;
        }
    </style>
</head>
<body>
    <div class="box"></div>
    <script src="./jquery3.3.1.js"></script>
    <script>
        // obox.onclick=function(){...}
        // addClass() 添加类
        // removeClass() 删除这个类
        $(".box").click(function(){
            // $(".box").addClass('black')
            $(this).addClass('black');
        })
    </script>
</body>
</html>